home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / OS / FWGraphx / Include / FWArcShp.h next >
Encoding:
Text File  |  1995-11-08  |  3.3 KB  |  124 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWArcShp.h
  4. //    Release Version:    $ 1.0d11 $
  5. //
  6. //    Copyright:    © 1993, 1995 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWARCSHP_H
  11. #define FWARCSHP_H
  12.  
  13. #ifndef FWBNDSHP_H
  14. #include "FWBndShp.h"
  15. #endif
  16.  
  17. // ----- Foundation Includes -----
  18.  
  19. #ifndef FWSTDDEF_H
  20. #include <FWStdDef.h>
  21. #endif
  22.  
  23. #if FW_LIB_EXPORT_PRAGMAS
  24. #pragma lib_export on
  25. #endif
  26.  
  27. //========================================================================================
  28. //    Forward Declarations
  29. //========================================================================================
  30.  
  31. class FW_CLASS_ATTR FW_CGraphicContext;
  32.  
  33. //========================================================================================
  34. //    class FW_CArcShape
  35. //========================================================================================
  36.  
  37. class FW_CLASS_ATTR FW_CArcShape : public FW_CBoundedShape
  38. {
  39. public:
  40.     FW_DECLARE_CLASS
  41.  
  42. //----------------------------------------------------------------------------------------
  43. //    Constructors/Destructors
  44. //
  45. public:
  46.     FW_CArcShape(const FW_CRect& rect, 
  47.                 short startAngle, short arcAngle,
  48.                  FW_ERenderVerbs renderVerb,
  49.                  const FW_PInk& ink = FW_kNormalInk,
  50.                  const FW_PStyle& style = FW_kNormalStyle);
  51.  
  52.     FW_CArcShape(const FW_CArcShape& other);
  53.     FW_CArcShape(FW_CReadableStream& archive);
  54.     
  55.     virtual ~ FW_CArcShape();
  56.  
  57. //----------------------------------------------------------------------------------------
  58. //    Operators
  59. //
  60. public:
  61.     FW_CArcShape& operator=(const FW_CArcShape& other);
  62.     
  63. //----------------------------------------------------------------------------------------
  64. //    Inherited API
  65. //
  66. public:
  67.     // ----- Rendering -----
  68.     virtual void                 Render(FW_CGraphicContext& gc) const;
  69.                                 
  70.     // ----- Hit Testing -----
  71.     virtual FW_Boolean         HitTest(FW_CGraphicContext& gc,
  72.                                         const FW_CPoint& test,
  73.                                         FW_CFixed tolerance) const;
  74.  
  75.     // ----- Copying -----
  76.     virtual FW_CShape*            Copy() const;
  77.     
  78.     // ----- Flatten -----
  79.     virtual void                Flatten(FW_CWritableStream& archive) const;
  80.     static void*                 Read(FW_CReadableStream& archive);
  81.  
  82. //----------------------------------------------------------------------------------------
  83. //    New API
  84. //
  85. public:
  86.     // ----- Rendering -----
  87.     static void                 RenderArc(FW_CGraphicContext& gc,
  88.                                             const FW_CRect& rect, 
  89.                                             short startAngle, short arcAngle,
  90.                                             FW_ERenderVerbs renderVerb,
  91.                                             const FW_PInk& ink = FW_kNormalInk,
  92.                                             const FW_PStyle& style = FW_kNormalStyle);
  93.  
  94.     // ----- Geometry -----
  95.     void                        GetGeometry(FW_CRect& rect, short& startAngle, short& arcAngle) const;
  96.     void                        SetGeometry(const FW_CRect& rect, short startAngle, short arcAngle);
  97.  
  98.     short                        GetStartAngle() const
  99.                                     {return fStartAngle;}    
  100.     void                        SetStartAngle(short angle)
  101.                                     {fStartAngle = angle;}
  102.     
  103.     short                        GetArcAngle() const
  104.                                     {return fArcAngle;}    
  105.     void                        SetArcAngle(short angle)
  106.                                     {fArcAngle = angle;}
  107.  
  108. private:
  109.     short                         CalcAngle(const FW_CPoint& test) const;
  110.  
  111. //----------------------------------------------------------------------------------------
  112. //    Data Members
  113. //
  114. private:
  115.     short            fStartAngle;    
  116.     short            fArcAngle;
  117. };
  118.  
  119. #if FW_LIB_EXPORT_PRAGMAS
  120. #pragma lib_export off
  121. #endif
  122.  
  123. #endif
  124.